package cn.ac.iscas.service.junit;


import org.junit.BeforeClass;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;


import cn.ac.iscas.bean.user.User;
import cn.ac.iscas.bean.user.UserType;
import cn.ac.iscas.service.user.IUserService;


public class UserJunitTest {
	public static IUserService service;
	@BeforeClass
	public static void setUpBeforeClass() throws Exception {
		try {
			ApplicationContext act = new ClassPathXmlApplicationContext("application-context.xml");
			service= (IUserService)act.getBean("userServiceImp");
		} catch (RuntimeException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}	
	}
     @Test
   public void save()
   {
	 User user = new User();
	 user.setPassword("1234");
	 user.setRealName("zhangxiaojieaa");
	 user.setUserName("jerry1234");
	 user.setUserType(UserType.ADMINISTRATOR);
	 service.save(user);
	}
     @Test
     public void delete()
     {
    	 service.delete(service.get(User.class, 1));
     }
     public void test()
     {
    	 
     }
}
